public class Solution1598 {
    public int minOperations(String[] logs) {
        int ans=0;
        for (String log : logs) {
            if (log.startsWith("..")){
                ans=Math.max(ans-1,0);
            }else if (!log.startsWith(".")){
                ans++;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1598().minOperations(new String[]{"d1/","d2/","../","d21/","./"}));
    }
}
